package com.sample.tab;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;

public class TabActivity extends Activity {
     TabHost tabhost1;
     TabHost.TabSpec specs[];
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        specs=new TabHost.TabSpec[3];
        tabhost1= (TabHost)findViewById(R.id.tabhost1);
        tabhost1.setup();
        
        for(int x=0;x<3;x++){
        specs[x]=tabhost1.newTabSpec("tag" + x);
        if (x==0){
            specs[0].setContent(R.id.tab1);
        }
        if (x==1){
            specs[1].setContent(R.id.tab2);
        }
        if (x==2){
            specs[2].setContent(R.id.tab3);	
        }
        specs[x].setIndicator("Tab" + x);
        tabhost1.addTab(specs[x]);
        }
    }
}